<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Module: RLayout</title>

	<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

	<script src="./js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="module">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="./rlayout_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout.rb">rlayout.rb</a></li>
					
						<li><a href="./rlayout/exceptions_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/exceptions.rb">rlayout/exceptions.rb</a></li>
					
						<li><a href="./rlayout/exporters/exporter_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/exporters/exporter.rb">rlayout/exporters/exporter.rb</a></li>
					
						<li><a href="./rlayout/exporters/lfs_directory_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/exporters/lfs_directory.rb">rlayout/exporters/lfs_directory.rb</a></li>
					
						<li><a href="./rlayout/exporters/lfs_zipfile_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/exporters/lfs_zipfile.rb">rlayout/exporters/lfs_zipfile.rb</a></li>
					
						<li><a href="./rlayout/importers/http_file_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/http_file.rb">rlayout/importers/http_file.rb</a></li>
					
						<li><a href="./rlayout/importers/http_filenode_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/http_filenode.rb">rlayout/importers/http_filenode.rb</a></li>
					
						<li><a href="./rlayout/importers/lfs_file_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/lfs_file.rb">rlayout/importers/lfs_file.rb</a></li>
					
						<li><a href="./rlayout/importers/lfs_filenode_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/lfs_filenode.rb">rlayout/importers/lfs_filenode.rb</a></li>
					
						<li><a href="./rlayout/importers/lfs_glob_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/lfs_glob.rb">rlayout/importers/lfs_glob.rb</a></li>
					
						<li><a href="./rlayout/importers/mem_text_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/mem_text.rb">rlayout/importers/mem_text.rb</a></li>
					
						<li><a href="./rlayout/importers/mem_textnode_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/mem_textnode.rb">rlayout/importers/mem_textnode.rb</a></li>
					
						<li><a href="./rlayout/importers/os_exec_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/os_exec.rb">rlayout/importers/os_exec.rb</a></li>
					
						<li><a href="./rlayout/importers/os_execnode_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/importers/os_execnode.rb">rlayout/importers/os_execnode.rb</a></li>
					
						<li><a href="./rlayout/node_naming_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/node_naming.rb">rlayout/node_naming.rb</a></li>
					
						<li><a href="./rlayout/runtime_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/runtime.rb">rlayout/runtime.rb</a></li>
					
						<li><a href="./rlayout/vfs_group_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/vfs_group.rb">rlayout/vfs_group.rb</a></li>
					
						<li><a href="./rlayout/vfs_node_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/vfs_node.rb">rlayout/vfs_node.rb</a></li>
					
						<li><a href="./rlayout/vfs_streamable_node_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/vfs_streamable_node.rb">rlayout/vfs_streamable_node.rb</a></li>
					
						<li><a href="./rlayout/vfs_traversal_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="rlayout/vfs_traversal.rb">rlayout/vfs_traversal.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			

			<!-- Namespace Contents -->
			
			<div id="namespace-list-section" class="section">
				<h3 class="section-header">Namespace</h3>
				<ul class="link-list">
					
					<li><span class="type">MODULE</span> <a href="RLayout/Exporters.html">RLayout::Exporters</a></li>
					
					<li><span class="type">MODULE</span> <a href="RLayout/Importers.html">RLayout::Importers</a></li>
					
					<li><span class="type">CLASS</span> <a href="RLayout/Error.html">RLayout::Error</a></li>
					
					<li><span class="type">CLASS</span> <a href="RLayout/Runtime.html">RLayout::Runtime</a></li>
					
					<li><span class="type">CLASS</span> <a href="RLayout/VFSGroup.html">RLayout::VFSGroup</a></li>
					
					<li><span class="type">CLASS</span> <a href="RLayout/VFSNode.html">RLayout::VFSNode</a></li>
					
					<li><span class="type">CLASS</span> <a href="RLayout/VFSStreamableNode.html">RLayout::VFSStreamableNode</a></li>
					
				</ul>
			</div>
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-c-derive_name">::derive_name</a></li>
					
					<li><a href="#method-c-vfs_group">::vfs_group</a></li>
					
					<li><a href="#method-c-vfs_preorder">::vfs_preorder</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="./License.html">License</a></li>
				
					<li class="file"><a href="./README.html">README</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="./images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="./RLayout.html">RLayout</a></li>
				
					<li><a href="./RLayout/Error.html">RLayout::Error</a></li>
				
					<li><a href="./RLayout/Exporters.html">RLayout::Exporters</a></li>
				
					<li><a href="./RLayout/Exporters/Exporter.html">RLayout::Exporters::Exporter</a></li>
				
					<li><a href="./RLayout/Exporters/LFSDirectory.html">RLayout::Exporters::LFSDirectory</a></li>
				
					<li><a href="./RLayout/Exporters/LFSDirectory/MyStreamHandler.html">RLayout::Exporters::LFSDirectory::MyStreamHandler</a></li>
				
					<li><a href="./RLayout/Exporters/LFSZipFile.html">RLayout::Exporters::LFSZipFile</a></li>
				
					<li><a href="./RLayout/Exporters/LFSZipFile/MyStreamHandler.html">RLayout::Exporters::LFSZipFile::MyStreamHandler</a></li>
				
					<li><a href="./RLayout/Exporters/StreamHandler.html">RLayout::Exporters::StreamHandler</a></li>
				
					<li><a href="./RLayout/Importers.html">RLayout::Importers</a></li>
				
					<li><a href="./RLayout/Importers/HttpFileNode.html">RLayout::Importers::HttpFileNode</a></li>
				
					<li><a href="./RLayout/Importers/LFSFileNode.html">RLayout::Importers::LFSFileNode</a></li>
				
					<li><a href="./RLayout/Importers/LFSGlobbingHelper.html">RLayout::Importers::LFSGlobbingHelper</a></li>
				
					<li><a href="./RLayout/Importers/MemTextNode.html">RLayout::Importers::MemTextNode</a></li>
				
					<li><a href="./RLayout/Importers/OSExecNode.html">RLayout::Importers::OSExecNode</a></li>
				
					<li><a href="./RLayout/Runtime.html">RLayout::Runtime</a></li>
				
					<li><a href="./RLayout/Runtime/ErrorFormatter.html">RLayout::Runtime::ErrorFormatter</a></li>
				
					<li><a href="./RLayout/VFSGroup.html">RLayout::VFSGroup</a></li>
				
					<li><a href="./RLayout/VFSNode.html">RLayout::VFSNode</a></li>
				
					<li><a href="./RLayout/VFSStreamableNode.html">RLayout::VFSStreamableNode</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="module">RLayout</h1>

		<div id="description">
			<p>
Main module of <a href="RLayout.html">RLayout</a>
</p>

		</div>

		<!-- Constants -->
		
		<div id="constants-list" class="section">
			<h3 class="section-header">Constants</h3>
			<dl>
			
				<dt><a name="NodeTagPair">NodeTagPair</a></dt>
				
				<dd class="description"><p>
Structure to hold a node and its parent tag
</p></dd>
				
			
			</dl>
		</div>
		

		<!-- Attributes -->
		

		<!-- Methods -->
		
		<div id="public-class-method-details" class="method-section section">
			<h3 class="section-header">Public Class Methods</h3>

		
			<div id="derive-name-method" class="method-detail ">
				<a name="method-c-derive_name"></a>

				<div class="method-heading">
				
					<span class="method-name">derive_name</span><span
						class="method-args">(converter, *args)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Derive node name using <tt>converter</tt> and possible arguments
<tt>args</tt> If converter is a string the converter is assumed ot be a
constant function returning that string.
</p>
					

					
					<div class="method-source-code"
						id="derive-name-source">
<pre>
    <span class="ruby-comment cmt"># File rlayout/node_naming.rb, line 7</span>
 7:   <span class="ruby-keyword kw">def</span> <span class="ruby-constant">RLayout</span>.<span class="ruby-identifier">derive_name</span>(<span class="ruby-identifier">converter</span>, *<span class="ruby-identifier">args</span>)
 8:     <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">nil</span>
 9:     <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">converter</span>
10:       <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">result</span> = <span class="ruby-identifier">converter</span>
11:       <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Proc</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">result</span> = <span class="ruby-identifier">converter</span>.<span class="ruby-identifier">call</span>(*<span class="ruby-identifier">args</span>).<span class="ruby-identifier">to_s</span>
12:     <span class="ruby-keyword kw">end</span>
13:     <span class="ruby-identifier">result</span>
14:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="vfs-group-method" class="method-detail ">
				<a name="method-c-vfs_group"></a>

				<div class="method-heading">
				
					<span class="method-name">vfs_group</span><span
						class="method-args">(name)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Instance a new virtual file system group
</p>
					

					
					<div class="method-source-code"
						id="vfs-group-source">
<pre>
     <span class="ruby-comment cmt"># File rlayout/vfs_group.rb, line 112</span>
112:   <span class="ruby-keyword kw">def</span> <span class="ruby-constant">RLayout</span>.<span class="ruby-identifier">vfs_group</span>(<span class="ruby-identifier">name</span>)
113:     <span class="ruby-constant">VFSGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>)
114:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="vfs-preorder-method" class="method-detail ">
				<a name="method-c-vfs_preorder"></a>

				<div class="method-heading">
				
					<span class="method-name">vfs_preorder</span><span
						class="method-args">(root, init_tag = nil, opts = {})</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Iterates in preorder starting at <tt>root</tt>. The <tt>block</tt>
parameter is called for each node visted.
</p>
<p>
Each node can be associated with a tag which is passed to <tt>block</tt>
in conjunction with the current node. If <tt>block</tt> returns a tag it
is associated with all children of the current node. The tag associated
with <tt>root</tt> is <tt>init_tag</tt>.
</p>
<h3>Example</h3>
<pre>
 a = VFSGroup.new('a')
 a.b.c

 str = ''
 depth = {}
 RLayout.vfs_preorder(a, 0) do |n, depth|
   depth[n.name] = depth
   depth + 1
 end
 
 str #=&gt; 'abc'
 depth #=&gt; {'a'=&gt;0, 'b'=&gt;1, 'c'=&gt;2}
</pre>
<p>

</p>
					

					
					<div class="method-source-code"
						id="vfs-preorder-source">
<pre>
    <span class="ruby-comment cmt"># File rlayout/vfs_traversal.rb, line 29</span>
29:   <span class="ruby-keyword kw">def</span> <span class="ruby-constant">RLayout</span>.<span class="ruby-identifier">vfs_preorder</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">init_tag</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">opts</span> = {}, &amp;<span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># :yields: node, parent tag</span>
30:     <span class="ruby-identifier">myopts</span> = {<span class="ruby-value">:unroll_incomplete</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>)
31:     <span class="ruby-identifier">stack</span> = []
32:     <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">NodeTagPair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">init_tag</span>))
33:     <span class="ruby-keyword kw">while</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">stack</span>.<span class="ruby-identifier">empty?</span>)     
34:       <span class="ruby-identifier">ntp</span> = <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">pop</span>
35:       <span class="ruby-identifier">node_tag</span> = <span class="ruby-keyword kw">nil</span>
36:       <span class="ruby-comment cmt"># Support for blocks that just accept a node and blocks that accept a node and its tag.</span>
37:       <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span>
38:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>)
39:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">node_tag</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>, <span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">parent_tag</span>)
40:       <span class="ruby-keyword kw">end</span>
41:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">VFSGroup</span>)
42:         <span class="ruby-identifier">subnodes</span> = <span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">values</span>
43:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>.<span class="ruby-identifier">incomplete?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">myopts</span>[<span class="ruby-value">:unroll_incomplete</span>]
44:           <span class="ruby-identifier">tmp_node</span> = <span class="ruby-constant">VFSGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'temporary'</span>)
45:           <span class="ruby-identifier">tmp_node</span>.<span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">subnodes</span>)
46:           <span class="ruby-identifier">tmp_node</span>.<span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">ntp</span>.<span class="ruby-identifier">node</span>.<span class="ruby-identifier">unroll</span>)
47:           <span class="ruby-identifier">subnodes</span> = <span class="ruby-identifier">tmp_node</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">values</span>
48:         <span class="ruby-keyword kw">end</span>
49:         <span class="ruby-comment cmt"># Push subnodes in reverse order so that they arrive in-order</span>
50:         <span class="ruby-identifier">subnodes</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
51:           <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">NodeTagPair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">node</span>, <span class="ruby-identifier">node_tag</span>))
52:         <span class="ruby-keyword kw">end</span>
53:       <span class="ruby-keyword kw">end</span>
54:     <span class="ruby-keyword kw">end</span>
55:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

